themingbackground: Call shadow function directly
authorBenjamin Otte <otte@redhat.com>
Wed, 8 Oct 2014 03:10:42 +0000 (05:10 +0200)
committerBenjamin Otte <otte@redhat.com>
Wed, 8 Oct 2014 03:20:31 +0000 (05:20 +0200)
... instead of having a custom function for it.

gtk/gtkthemingbackground.c

index 6b51e0c3668df7582c597a2af855175def4ef84c..e85f9ae5e27156cf8047b114fc13970167414c86 100644 (file)
@@ -256,17 +256,6 @@ _gtk_theming_background_paint_layer (GtkThemingBackground *bg,
   cairo_restore (cr);
 }
 
-static void
-_gtk_theming_background_apply_shadow (GtkThemingBackground *bg,
-                                      cairo_t              *cr,
-                                      gboolean              inset)
-{
-  _gtk_css_shadows_value_paint_box (_gtk_style_context_peek_property (bg->context, GTK_CSS_PROPERTY_BOX_SHADOW),
-                                    cr,
-                                    &bg->boxes[inset ? GTK_CSS_AREA_PADDING_BOX : GTK_CSS_AREA_BORDER_BOX],
-                                    inset);
-}
-
 static void
 _gtk_theming_background_init_context (GtkThemingBackground *bg,
                                       double                width,
@@ -313,6 +302,7 @@ gtk_theming_background_render (GtkStyleContext      *context,
   GtkThemingBackground bg;
   gint idx;
   GtkCssValue *background_image;
+  GtkCssValue *box_shadow;
   const GdkRGBA *bg_color;
 
   bg.context = context;
@@ -321,11 +311,16 @@ gtk_theming_background_render (GtkStyleContext      *context,
 
   background_image = _gtk_style_context_peek_property (bg.context, GTK_CSS_PROPERTY_BACKGROUND_IMAGE);
   bg_color = _gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (bg.context, GTK_CSS_PROPERTY_BACKGROUND_COLOR));
+  box_shadow = _gtk_style_context_peek_property (bg.context, GTK_CSS_PROPERTY_BOX_SHADOW);
 
   cairo_save (cr);
   cairo_translate (cr, x, y);
 
-  _gtk_theming_background_apply_shadow (&bg, cr, FALSE); /* Outset shadow */
+  /* Outset shadows */
+  _gtk_css_shadows_value_paint_box (box_shadow,
+                                    cr,
+                                    &bg.boxes[GTK_CSS_AREA_BORDER_BOX],
+                                    FALSE);
 
   _gtk_theming_background_paint_color (&bg, cr, bg_color, background_image);
 
@@ -334,7 +329,11 @@ gtk_theming_background_render (GtkStyleContext      *context,
       _gtk_theming_background_paint_layer (&bg, idx, cr);
     }
 
-  _gtk_theming_background_apply_shadow (&bg, cr, TRUE);  /* Inset shadow */
+  /* Inset shadows */
+  _gtk_css_shadows_value_paint_box (box_shadow,
+                                    cr,
+                                    &bg.boxes[GTK_CSS_AREA_PADDING_BOX],
+                                    TRUE);
 
   cairo_restore (cr);
 }